#include <vector>
#include <string>
#include <unordered_map>

using namespace std;

class DepController {
public:
    DepController() {}
    virtual ~DepController() {}
    void Exec(const string &cmd, const string &module,
        const vector<string> &deps);
    struct mproperties_t {
    public:
        bool isexplicit;
        unsigned int numdeps;
        mproperties_t(bool exp = false, int num = 0):
            isexplicit(exp), numdeps(num) { }
    };

private:
    // dependancy hash table
    unordered_map<string, vector<string>> depmap;
    // hash table which contains a list of modules
    // and the number of elements depending on it
    unordered_map<string, mproperties_t> mlist;
    void AddDep(const string &module, const vector<string> &deps);
    void Install(const string &module, bool isexplicit);
    void Remove(const string &module, bool isexplicit);
    void ListAll();
};
